package masterjava.common.store;

import java.util.Iterator;
import java.util.Map;

/**
 * MasterJava.ru
 * <p/>
 * User: GKislin
 * Date: 02.03.11
 *
 * Map based PropertiesStore
 *
 */
public class MapStore extends AdapterPropertiesStore {

    private final Map<String, String> propMap;

    public MapStore(Map<String, String> map) {
        propMap = map;
    }

    @Override
    public String load(String key) {
        return propMap.get(key);
    }

    @Override
    public void save(String key, String newValue) {
        propMap.put(key, newValue);
    }

    @Override
    public Iterator<String> getKeysIterator() {
        return propMap.keySet().iterator();
    }
}
